import Vue from 'vue'
import VueRouter from 'vue-router'
import agents from './moudules/agents'
import categories from './moudules/categories'
import about from './moudules/about'
import dashboard from './moudules/dashboard'
import list from './moudules/list'
import detail from './moudules/detail'
import test from './moudules/test'

Vue.use(VueRouter)

const routes = [
  {
    // 重定向
    path: '/',
    redirect: '/dashboard'
  },
  agents,categories,about,list,dashboard,detail,test
]

const router = new VueRouter({
  routes
})
const originalPush = VueRouter.prototype.push
// 修改 原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err=>err)
}

export default router
